Part Number Hot Search : 
3405AF PIC18F4 MBT3904 TZ0475A X5323S8 X5323S8 DR100D12 1452A
Product Description
Full Text Search
 

To Download RLT16324R680FN-06 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  august 2010 doc id 17051 rev 1 1/34 an3151 application note digital constant-current controller for led applications ba sed on stm8s208x introduction leds have been used for many years simply as status indicators but are now playing a considerable role in a host of application fields, even with high power requirements, due to improvements in lighting efficien cy, longer lifetime, reliability, and costs. led-based lighting systems are increasingly used in display panels, emergency lighting, architectural lighting and also backlighting. the growth of such systems is mainly d ue to new manufacturing technologies and innovations in this segment area, which probably represent the most important markets within the lighting field. the intent of this application note is to describe a new technique, based on a digital approach, performing a real average current-control on an led streetlighting platform. a demonstration board, based on this approach, is orderable with the steval-ill031v1 code. further details are shown in steval-ill031v1 documentation. the led streetlight platform has been developed on a dc-dc converter based on an ?inverse buck? converter, creating advantages in terms of power switch control and conditioning signal circuitry for the current sensing. moreover, performance, including cost performance, is also looked at. this solution has been customized for a streetlighting application but can be extended to many other fields. the advantages offered are in terms of low energy consumption, low maintenance, and a small and lightweight design. the real aim of this application note is to describe the average current-control methodology suitable for led driving. the effectiveness of the control with the inverse buck's advantages is described on a dimmable platform, based on a multi-string system up to 120 w with independent current control. two different kinds of dimming have been implemented: analog, also called linear dimming, and digital. the control has been implemented on the stm8s208rb microcontroller, [ 1 ] which is the best compromise in terms of cost and performance, validating an innovative current reading methodology. www.st.com
contents an3151 2/34 doc id 17051 rev 1 contents 1 hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1 power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 microcontroller peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1 timer1: advanced control timer (tim1) . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 overview of inverse buck con verter . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 average current reading methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4 independent current control for a multi-string system . . . . . . . . . . . . 14 5 firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.1 basic initialization of peripherals and i/o pins . . . . . . . . . . . . . . . . . . . . . 17 5.2 peripheral settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3 pi regulator overview and firmware implem entation . . . . . . . . . . . . . . . . 19 6 board description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7 experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8 short-circuit protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 9 bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 10 references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 11 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
an3151 list of figures doc id 17051 rev 1 3/34 list of figures figure 1. principle schematic of the circuit described . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 figure 2. power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 3. control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 4. tim1 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 5. tim1 and adc triggering functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 6. inverse buck converter (single-string). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 7. counter(a), pwm(b) and iled(c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 8. multi string current control methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 9. basic flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 10. current control flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 11. pi standard controller with anti-saturation control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 12. led street light platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 13. iled on 3 strings (green, blue and violet waveforms); pwm @100 khz (yellow waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 14. iled on 3 strings (green, blue and violet waveforms); voltage across the sense resistor (yellow waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 15. iled on 3 strings (green, violet and blue waveforms) @ 60% of duty cycle (pwm dimming) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 16. iled on string (violet waveform) @ minimum pwm dimming; pwm (yellow waveform) . . 25 figure 17. mosfet turn-on zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 18. mosfet turn-off zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 19. overall efficiency (4 channels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 20. short-circuit protection circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 21. short-circuit event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 22. electro-optical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
hardware an3151 4/34 doc id 17051 rev 1 1 hardware the hardware is mainly composed of the power conversion section and the control stage, based on the microcontroller unit. from a common dc voltage input the 4 strings are driven by 4 inverse dc-dc buck converters. the inverse buck converter offers advantages not only in the driving section and the ground referred circuitry but also in terms of cost. all these aspects are explained in detail in the power stage. the principle schematic of the circuit descri bed in this application note is shown in figure 1 . figure 1. principle schematic of the circuit described !-v $'& 6706[[ 0lf urfrqwuroohu 3:0 7 3:0 7 7 7 3 : 0  $ ' &  3 : 0  $ ' &  3 : 0  $ ' &  9lq 
an3151 hardware doc id 17051 rev 1 5/34 1.1 power stage figure 2 shows the schematic of the power stage with 4 output channels: figure 2. power stage !-v 9 3:0)rxuwk6wulqj 3:07klug6wulqj 3:06hfrqg6wulqj 3:0)luvw6wulqj 6hqvlqj6hfrqg6wulqj 6hqvlqj7klug6wulqj 9exv 9exv 9exv 9exv 9exv 9exv 9exv 6hqvlqj)rxuwk6wulqj 9exv *1' *1' 9 5 5:  & x9  & x9 & q)9 & q)9  & x9  & x9 & q)9 4 4 6711)627  & x9  & x9 ' & q)9 5 2kp & s - &21   5 rkp / & q)9 / & s &21 - &21   - &21 - &21   5 5: ' 4 6711)627 & s / & s   & x9 5 2kp & q)9 ' / ' 5 2kp 5 2kp &21 - &21   ' 1'2 ' 1'2 & x)9 & x)9 5 5: - &21 - &21   5 rkp 2kp 5 4 6711)627 &21 - &21   5 5: 5 rkp 4 6711)627 5 rkp 6736/$60$ 6736/$60$ 6736/$60$ 6736/$60$
hardware an3151 6/34 doc id 17051 rev 1 four dc-dc buck converters allow 4 led strings to be driven, managing up to 120 w. from a 48 dc input voltage the buck stage adapts the output voltage in order to drive the leds with the imposed current. 3 w leds have been chosen in order to obtain 30 w per string, covering the total power with 10 leds [ 4 ] in series on each string. the buck stage works in continuous conduction mode (ccm) in order to minimize the current ripple on the leds. the inverse buck stage offers: low voltage sensing circuitry logic level mosfets driven by the microcontroller without a gate driver (ground referred) high efficiency of up to 98 % the led current, to be measured by the microcontroller, is sensed by a ground referred shunt resistor. this solution allows the current reading only when the mosfet is on. this is an important aspect to be evaluated for the current reading methodology to be described.
an3151 hardware doc id 17051 rev 1 7/34 1.2 control stage the control stage is based on an stm8s208rb. a 64-pin package has been used but the application can be easily implemented on smaller packages of the same product family (performance line). pwms, adc channels, gpios, used for this application, are provided directly to the power stage. figure 3 shows the complete schematic: figure 3. control stage !-v 3'b6zlp 5(6(7 5(6(7 7,0b&+ 3(&k)luvw6wulqj 3(&k6hfrqg6wulqj (qdeoh7klug6wulqj (qdeoh6hfrqg6wulqj 3*b/&'b&6 9''$ (qdeoh)luvw6wulqj 3)&k)rxuwk6wulqj 3&b026, 26&287 26&,1 3)&k7klug6wulqj 3:03& 3:03& 3:03& 3:03& 3)&k'lpplqj 3$8$57b5; 3$8$57b7; (qdeohb (qdeohb 3%b-2<67,&.b/()7 3%b-2<67,&.b5,*+7 3%b-2<67,&.b83 3%b-2<67,&.b'2:1 9uhi 3%b8vhu%xwwrq 3'b-2<67,&.b6(/ (qdeoh)rxuwk6wulqj 7,0b&+ /&'b&6 -2<b6(/ -2<b'2:1 -2<b83 -2<b5,*+7 -2<b/()7 6hqvlqj)luvw6wulqj 6hqvlqj6hfrqg6wulqj 63,b026,b/&' 6hqvlqj)rxuwk6wulqj 6hqvlqj7klug6wulqj 3:0)luvw6wulqj 3:06hfrqg6wulqj 3:07klug6wulqj 3:0)rxuwk6wulqj 3* 86(5b%87721 3* 3* -2<b'2:1 -2<b83 -2<b5,*+7 -2<b/()7 -2<b6(/ 6hqvlqj)luvw6wulqj 6hqvlqj6hfrqg6wulqj 6hqvlqj)rxuwk6wulqj 6hqvlqj7klug6wulqj 9 9 9 *1' *1' 9 *1' *1' *1' *1' 9b9''$ 9 9 9 9b9''$ 9 9 9 *1' 9 *1' *1' *1' -2<67,&.07$ 5 5 5 5 5 5 5 . 5 . - -       5 5 5 5 & s) & s) & q) & q) & x) & x) 5 . 5 . ' ' 5 n 5 n 5 . 5 . & s) & s) 5 n 5 n 5 5 5 5 & s) & s) 3 n    & q) & q) 5 - - &rpp&rqqhfwru     n 5 n ' ' & s) & s) 5 5 5 5 & q) & q) & s) & s) & q) & q) 5 n 5 n & q) & q) ; 0+] ; 0+] & s) & s) 5 & q) & q) / %($' / %($' & q) & q) ' ' 5 . 5 . 5 5 5 5 5 5 5 5 8 67065% 8 67065% 9''$  966$  9uhi  3)$,1  3%$,1  3%$,1  3%$,1>,&b6'$@  3%$,1>,&b6&/@  9'',2b  3&63,b026,  3&63,b0,62  3*&$1b7;  3*&$1b5;  3*  3*  3*  3'8$57b5;  3'8$57b7;  3'7,0b&+>%((3@  3'7,0b&+>$'&b(75@  3'7,0b&+>7,0b&+@  3'6:,0  3)$,1  3)$,1  3)$,1  3%$,1>7,0b&+1@  3'7/,>7,0b&+@  1567  3$26&,1  3$26&287  966,2b  966  9&$3  9''  9'',2b  3$7,0b&+>7,0b&+@  3$8$57b5;  3$8$57b7;  3$8$57b&.  3)$,1  3)$,1  9uhi  3%$,1>7,0b&+1@  3($,1  3($,1  3(63,b166  3&7,0b&+  3&7,0b&+  3&7,0b&+  3&7,0b&+  3,  3*  3*  3*  3(  3(7,0b%.,1  3( 7 ,&b6'$  3( 7 ,&b6&/  966,2b  3(&/.b&&2  3%$,1>7,0b(75@  3'7,0b&+>7,0b%.,1@>&/.b&&2@  3%$,1>7,0b&+1@  3&63,b6&.  6: uhvhw 6: uhvhw 5 0 5 0 & x) x) ' 5(' ' 5(' & q) 5 5 5 5 & s) & s) n 5 n 5  5  - &21$ - &21$     & q) & q) 5   & q) & q) & s) & s) 5 5 5 5 & q) & q) 5 . 5 . 5 n 5 n 5 5 5 5 5 . 5 . ' ' 5 n - 6zlp&rqqhfwru 6zlp&rqqhfwru     & s) & s) 5 n 5 n
microcontroller peripherals an3151 8/34 doc id 17051 rev 1 2 microcontroller peripherals the control is fully dedicated to the microcon troller which is suitable for managing pwm generation, analog sensing, by means of adc, and executing four independent current loops through pi standard controllers. 2.1 timer1: advanced control timer (tim1) figure 4 shows the tim1 block diagram figure 4. tim1 block diagram the tim1 is a 16-bit advanced control timer with many settings and features for industrial and motor control applications including protection for fault management. the main features are: 16-bit up, down, and up/down counter with auto reload function 4 independent channels with several configurations (input capture, output compare, edge or center aligned pwm, one pulse mode and complementary outputs) break input interrupt and trigger event the current reading methodology used in this application needs a trigger event, generated by the timer, in order to start the adc. for further details refer to the stm8s reference manual rm0016 [ 1 ].
an3151 microcontroller peripherals doc id 17051 rev 1 9/34 2.2 ad converter some interesting characteristics of this microcontroller are highlighted here, like pwm peripheral and adc triggering functions conducting to a pi current regulation loop for every channel. figure 5. tim1 and adc triggering functions in figure 5 above, the adc peripheral block diagram is shown. the main adc features used in this application are: 10-bit with 16 multiplexed channels 3.5 s of conversion time @ 4 mhz external trigger and timer trigger selection end of conversion interrupt the most important feature is the triggering function, forced by tim1, used to enable the conversion on some timer events (reset, enable, up/down, and count). !-v  $1$/2*72',*,7$/ &219( 57(5   3rzhu $qdorjslqv  &orfn 3uhvfdoh u  'dwd5h j lvwhuelwv  9 5() 9 5() 9 ''$ 9 66$  $,1 $,1 $,1 3'      *3,2v  7lphu  i $'& i 0$67(5  $'&5hjlvwhuv  (2&(qgri ,qwhuuxsw 4rigger $atabus
overview of inverse buck converter an3151 10/34 doc id 17051 rev 1 3 overview of inverse buck converter the inverse buck stage offers the advantages previously mentioned and is managed by the same equations as the standard buck converter. here in short, some details rela ted to the dc-dc converter stage, with further details of the analog designing [ 3 ]. theory of operation the voltage across the l inductor is calculated using the following formula: equation 1 where: v l =inductor voltage (v) l=inductance (h) i l =inductor current (a) figure 6. inverse buck converter (single-string) the following equations were used in the design: table 1. electrical specs description symbol value unit input voltage v in 48 v white led v f everlight ehp-ax08el p03-v4 led forward voltage v fmin =3.85 @ 700 ma v fmax =4.15 @ 700 ma v dt di l v l l = !-v 9 ,1 3:0 9 $'& 9 ,1 3:0 3:0 9 9 / 9 ,1 9 /(' 9 / 9 /(' w 21 wlph w 2)) wlph
an3151 overview of inverse buck converter doc id 17051 rev 1 11/34 the output voltage =v led = n* v f (typical)=40 v where n=number of leds per string=10 and v f is the typical forward voltage (4 v). forward voltage has some variation in respect to the typical value and the led manufacturer reports also the minimum forward voltage v fmin and maximum forward voltage v fmax . these values must be considered for dimensioning of the power converter. the led characteristics are strongly dependent on manufacturer and are reported in their corresponding datasheets. in particular, these are necessary to calculate the duty cycle variation range. design spec calculation: equation 2 equation 3 =ton/ts and expressed in terms of voltage for a buck converter: equation 4 equation 5 equation 6 the current ripple admitted for this application is less than 10 % depending on the following formula: equation 7 i ledavg = average led current i led 10 % ripple current on the leds table 1. electrical specs (continued) description symbol value unit v outmin = v ledmin =n*v fmin =10*3.85 v=38.5 v v outmax =v ledmax =n*v fmax =10*4.15 v=41.5 v =vout/vin min= v outmin /vin=80.2 % max= v outmax /vin=86.4 % ? ? ? ? ? ? ? ? ? ? ? ? = = vin vout 1 l * fs vout i % 10 i i min min l l led
overview of inverse buck converter an3151 12/34 doc id 17051 rev 1 where: fs= 100 khz is the switching frequency; obtaining an inductance value of 1mh. a smaller value of 820 uh has been chosen for space saving reasons. 3.1 average current reading methodology the current reading methodology is based on an innovative technique suitable for the dc- dc stage (inverse buck) working in continuous conduction mode (ccm) or even in transition mode. the aim is to control the current because th e leds need a current control in order to maximize lifetime and brightness, and guarantee the technical specs provided by the led manufacturers. the most important target is to maintain a co nstant current even thoug h, for thermal issue, the typical forward voltage can change. this technique has been patented and is bas ed on microcontroller peripherals allowing the leds current to be sensed, flowing during the mosfet conduction, on the ton/2 event. the ton/2 current reading and conversion, by t he microcontroller, allows the average current value to be estimated. the current reading has been implemented on an stm8s208rb but can be easily implemented on the stm8s2x product family. the most important feature of this microcontroller is the adc triggering function by some timer events. further details can be seen in the reference manual [ 1 ]. the current sense has been obtained avoiding any external circuitry. the sense resistor is chosen in order to have the best compromise between signal noise ratio and power dissipation issues. below are some waveforms describing the proposed technique. the pwm counter is configured in the center-aligned mode. the counter counts from 0 to the auto-reload value (content of the timx_arr register) -1, generates a counter overflow event, then counts from the auto reload value down to 1 and generates a counter underflow event. then it restarts counting from 0. the up/down counting defines the center aligned pattern providing a triangular carrier. the overflow and underflow event can be used for adc triggering. in figure 7 the counting in up/down mode provides a triangular carrier. the oc register sets the duty cycle. the overflow event, during the ton/2, triggers the ad conversion and the result provides the average current value to be used in the control loop.
an3151 overview of inverse buck converter doc id 17051 rev 1 13/34 figure 7. counter(a), pwm(b) and i led (c) !-v $'&vdpsolqj#7rq 3:0 $yhudjh , /(' 2&5hjlvwhu &rxqwhu a b c
independent current control for a multi-string system an3151 14/34 doc id 17051 rev 1 4 independent current control for a multi-string system the aim of this control is to implement an average current control on four independent strings in order to cover the entire power rating requirement. the total power, 120 w, is covered using four strings up to 30 w with ten 3 w leds (everlight, ehp-ax08el-v4) [ 4 ] connected in series. the adc peripheral, in terms of maximum co nversion time, doesn't allow instantaneous conversion of 4 channels and in order to minimi ze the error introduced by the sample and hold circuitry a solution based on single-shot conversion is considered. the advanced timer tim1 starts the counting in up/down mode. the overflow event (crest of carrier waveform) is used for an update event which triggers the adc conversion. the single-shot conversion is enabled on a selected adc channel. once the analog to digital conversion is performed, the end of conv ersion interrupt (eoc isr) is served and the pi controller changes the duty cycle according to the control law. moreover, the new channel to be converted at the next update event is set and this is repeated cyclically until the four strings are controlled. the pi controllers, related to the other 3 channels, are not performed at this time. the four- string control is executed in 4 different update events. figure 8 shows a simple block diagram highlighting the four-string control: figure 8. multi string current control methodology the current control loop is executed as soon as the end of conversion interrupt service routine (eoc isr) is served. the update event, which triggers the adc for t he single shot conversion, occurs once every five pwm periods. although this decreases the system bandwidth, it leaves some time to other important tasks such as communication for remote control. !-v $'&vdpsolqj#7rqiruhyhu\fkdqqho $yhudjhfxuuhqw 3:0 2& uhj !$# 4riggering !$# 4riggering !$# 4riggering !$# 4riggering &irst3tring #urrent !$# 4riggering 0)$appliedon 34 3tring 0)$appliedon 34 3tring !$# 6alue#h !$# 6alue#h 3econd3tring #urrent 0)$appliedon nd 3tring !$# 6alue#h 4hird3tring #urrent 0)$appliedon rd 3tring !$# 6alue#h &ourth3tring #urrent 0)$appliedon th 3tring !$# 6alue#h t on $yhudjhfxuuhqw $yhudjhfxuuhqw $yhudjhfxuuhqw
an3151 independent current control for a multi-string system doc id 17051 rev 1 15/34 a sort of ?state machine?, implemented in the eoc isr, manages the current control on four strings while also looking after the dimming function. further details of the multi- string control algorithm follow. once the first channel conversion is comple ted the control checks which string is to be controlled and updates the new value of duty cycle thanks to a pi standard controller. once the duty cycle is updated, the control sets the next channel, relat ed to another string to be controlled, which is converted during the next update event on seven pwm counter overflows. in short, a single pi controlle r in the eoc isr is performed. the four pids are executed in 200 s calculated in this way: pwm period=10 s the update event occurs every 5 x pwm period= 50 s and, multiplying by 4, the total timing to execute and update the four pi controllers is obtained. pids execution = 200 s figure 9. basic flowchart note: after initialization, wa it until interrupt state is entered. the idea is to convert the current and correct the duty cycle of the pwm in order to maintain the same average current level. in figure 10 the basic algorithm flowchart is shown: basic initialization of peripherals, timer sync hronization with adc, interrupts and i/o pins. reading the led currents the adc eoc is served and the duty cycle updated. the entire control algorithm is executed into the interrupt routine thanks to pi controllers with anti wind-up in order to regul ate the average current at target. !-v 6wduw ?&,qlwldol]dwlrq 3hulskhudov 6:,qlwldol]dwlrq 0dlq /rzsulrulw\wdvnv  &rppxqlfdwlrq 'ldjqrvwlf?  $'&(2& ,65 %nd/f#onversion 4imer/verflowevent4riggers
independent current control for a multi-string system an3151 16/34 doc id 17051 rev 1 figure 10. current control flowchart note: a ?state machine? has been implemented into the eoc isr in order to control either a pi controller or the software dimming function. for any state, the new channel to be converted is set. !-v $'&,65 )2%4 %/#&irst3tring %/#3econd3tring %/#4hird3tring %/#&ourth3tring !pply$imming 0)$&irst3tring 3et next!$#onv #h 9e s 9e s 9e s 9e s .o .o .o .o 9e s 0)$3econd3tring 3etnext!$#onv #h 0)$&ourth3tring 3etnext!$#onv #h 0)$4hird3tring 3et next!$#onv #h 3et"lanking4ime 3et next!$#onv #h
an3151 firmware implementation doc id 17051 rev 1 17/34 5 firmware implementation below are some details of firmware implementation. it's not an exhaustive firmware implementation description but it mainly focuses on some important microcontroller settings: tim1, adc and pi controller implementation. the firmware developed for the led streetlight application is based on stm8s firmware library release 1.1 and entirely downloadable from the internet. the firmware described in this application note is entirely available; to obtain a copy please contact your closest st office. 5.1 basic initialization of peripherals and i/o pins at the beginning of the main program, all the peripherals and i/o pins are configured as described below: the clock source is selected in order to have the maximum frequency by means of an external 24 mhz oscillator. gpio pins are configured for: adc channels (floating input) and i/os. timer (tim1) configuration: ch1, ch2, ch3, and ch4 are configured in center aligned mode and provide an ad triggering signal to adc for conversion by trgo. adc configuration: ain8, ain9, ain10, ai n11, and ain12 are converted one by one during the ?update? event forced by tim1. single shot conversion has been set. other firmware settings are for interrupt and joystick/pushbutton management. the joystick, soldered onto the control section, is usef ul in debug phase to change the pi gains. this feature is implemented on a low priority interrupt. 5.2 peripheral settings the main peripheral settings are: clock configuration tim1 configuration adc configuration the clock configuration is related to the prescaler by means of the function: /* configure the fcpu to div1*/ clk_sysclkconfig(clk_prescaler_cpudiv1); the tim1 configuration is: tim1_deinit(); tim1_timebaseinit(0,tim1_countermode_centeraligned1, pwm_period,5);
firmware implementation an3151 18/34 doc id 17051 rev 1 tim1_oc1init(tim1_ocmode_pwm2, tim1_outputstate_enable, tim1_outputnstate_enable, ccr1_pwm_default, tim1_ocpolarity_high, tim1_ocnpolarity_high, tim1_ocidlestate_set, tim1_ocidlestate_reset); tim1_oc2init(tim1_ocmode_pwm2, tim1_outputstate_enable, tim1_outputnstate_enable, ccr2_pwm_default, tim1_ocpolarity_high, tim1_ocnpolarity_high, tim1_ocidlestate_set, tim1_ocidlestate_reset); tim1_oc3init(tim1_ocmode_pwm2, tim1_outputstate_enable, tim1_outputnstate_enable, ccr3_pwm_default, tim1_ocpolarity_high, tim1_ocnpolarity_high, tim1_ocidlestate_set, tim1_ocidlestate_reset); tim1_oc4init(tim1_ocmode_pwm2,tim1_outputstate_enable,ccr4_pwm_defa ult, tim1_ocpolarity_high,tim1_ocidlestate_reset); /* configure the tim1 master/slave mode */ tim1_selectmasterslavemode(enable); /* trigger the conversion */ tim1_selectoutputtrigger(tim1_trgosource_update); tim1_ctrlpwmoutputs(enable); tim1_cmd(enable); the adc configuration is: adc2_deinit(); adc2_prescalerconfig(adc2_pressel_fcpu_d2); adc2_conversionconfig(adc2_conversionmode_single, adc2_channel_8, adc2_align_right); /* enable eoc interrupt */ adc2_itconfig(enable);
an3151 firmware implementation doc id 17051 rev 1 19/34 /*configure the adc2 external trigger */ adc2_externaltriggerconfig(adc2_exttrig_tim, enable); adc2_cmd(enable); 5.3 pi regulator overview and firmware implementation the general formula for an analog pi regulator is: equation 8 where: (t) is the driving signal e (t) is the error signal, the difference between the actual value and the target value k p and k i are the proportional and the integral constant respectively in the case of digital regulators, the above equation becomes: equation 9 where: (n) is the driving signal sampled at the instant nt e (n) is the error signal sampled at the instant nt k p , k i are respectively the proportional and integral gains t is the sampling time the following can also be written: equation 10 and, subtracting equation 10 from equation 9 : equation 11 the equation shows the variation of the duty cycle (n) at the instant nt due to the current error in the same instant (term e(n)) and to its variation at the instants nt and (n-1)t (terms e(n) and ). () () ( ) + = t 0 i p d e * k t e * k t u () () () = + = n 0 i i p i e * t * k n e * k n u () () () + = + + = + 1 n 0 i i p i e * t * k 1 n e * k 1 n u ()() ()() [] () () ? ? ? ? ? ? ? ? ? + ? + = ? + = = + = n 0 i 1 n 0 i i p i e i e * t * k n e 1 n e * k n u 1 n u ) n ( u () ( ) [] 1 n e n e ? ?
firmware implementation an3151 20/34 doc id 17051 rev 1 in the pi algorithm, the error is first computed , and based on this, the variation of the duty cycle is calculated according to the equation, to reach and maintain the target average current. pi parameters tuning in order to perform a working average current regulation, it is fundamental to choose the right pi parameters depending on the system's bandwidth. unfortunately, to get the best pi parameters, there isn't a general procedure to follow and the fastest way to tune them is trial and error. however, please note that, besides making the closed loop system stable, the k p and k i parameters can also compensate the no n-linearity introduced into the system. pi algorithm an easy and efficient pi controller is impl emented. the algorithm uses an anti wind-up effect. this methodology allows the freezing of the integral action when the error signal is out of working range. in this way, it's possible to improve the dynamic of the current loop. in figure 11 , below, the diagram of the pi regulator is shown: figure 11. pi standard controller with anti-saturation control the c code is shown here: /***************************************************************** * function name : pid_regulator_first_string * description : compute the pi output for the current loop regulation. * input : none * output : s16 * return : none *****************************************************************/ s16 pid_regulator_first(pi_controllertypedef *pid, u16 current_string_input)
an3151 firmware implementation doc id 17051 rev 1 21/34 { s16 proportional_term, integral_term; s16 error, output_s16; error = (pid->reference - current_string_input); // proportional term computation proportional_term = pid->kp_gain * error; // integral term computation integral_term = pid->ki_gain * error; if ( (integral_firstrow >= 0) && (integral_term >= 0) && (pid- >max_pid_output == false) ) // freeze integral term in case of over/underflow { if ( (s32)(integral_firstrow + integral_term) < 0) {integral_firstrow = s16_max; } or else {integral_firstrow += integral_term; } } or else if ((integral_firstrow <= 0) && (integral_term <= 0) && (pid->min_pid_output == false) ) { if ( (s32)(integral_firstrow + integral_term) > 0) { integral_firstrow = -s16_max; } or else {integral_firstrow += integral_term; } } or else if ( (integral_firstrow <= 0) && (integral_term >= 0) ) {integral_firstrow += integral_term; } or else if ( (integral_firstrow >= 0) && (integral_term <= 0) ) {integral_firstrow += integral_term; }
firmware implementation an3151 22/34 doc id 17051 rev 1 output_s16 = (s16)((proportional_term>>12) + (integral_firstrow>>16)); if (output_s16 >= (s16)(pid->upper_limit_output)) {pid->max_pid_output = true; return(pid->upper_limit_output); } or else if (output_s16 < (s16)(pid->lower_limit_output)) { pid->min_pid_output = true; return(pid->lower_limit_output); } or else {pid->min_pid_output = false; pid->max_pid_output = false; return((s16)(output_s16)); } }
an3151 board description doc id 17051 rev 1 23/34 6 board description the evaluation board is configured as constant current supply. ta bl e 2 gives some details of the board: figure 12. led street light platform table 2. board description reference designator name description j2 j2 dc input voltage(48 v) j26 j26 logic input voltage (5 v) j11 swim connector programming connector sw1 reset button reset the microcontroller p1 trimmer trimmer for dimming
experimental results an3151 24/34 doc id 17051 rev 1 7 experimental results please note that the streetlight platform has been validated with everlight leds [ 4 ]. others kinds of leds may require some control parameter tuning. the joystick soldered onto the control section can be useful in or der to increase/decrease the proportional and integral gains and set the control. figures 13 , 14 , 15 , and 16 show the experimental results: figure 13. i led on 3 strings (green, blue and violet waveforms); pwm @100 khz (yellow waveform) figure 14. i led on 3 strings (green, blue and violet waveforms); voltage across the sense resistor (yellow waveform)
an3151 experimental results doc id 17051 rev 1 25/34 figure 15. i led on 3 strings (green, violet and blue waveforms) @ 60% of duty cycle (pwm dimming) figure 16. i led on string (violet wave form) @ minimum pwm dimming; pwm (yellow waveform)
experimental results an3151 26/34 doc id 17051 rev 1 some important information related to the power switches is also detailed. figures 17 , 18 , and 19 show some power dissipation issues and the total efficiency estimation: figure 17. mosfet turn-on zoom figure 18. mosfet turn-off zoom mosfet turn on zoom maximum power dissipation at turn on 40w mosfet turn off zoom maximum v ds extra voltage is 53.4v never achieving the avalanche maximum power dissipation at turn off 26w
an3151 experimental results doc id 17051 rev 1 27/34 figure 19. overall efficiency (4 channels)
short-circuit protection an3151 28/34 doc id 17051 rev 1 8 short-circuit protection failure protection is managed by the microcontroller and allows hardware damage to be avoided. this feature has not been impl emented on the steval-ill031v1 but, if necessary, the following circuitry can be taken into consideration ( figure 20 ). figure 20. short-circuit protection circuitry !-v 3ensing &irst3tring 3ensing 3econd3tring 3ensing 4hird3tring &!5,4 3ensing &ourth3tring 6 6 6 6 3hort circuit 0rotection &ault ./4 )-0,%-%.4%$ on 34%6!, ),,6 2  k 2  k 2  k 2  k 2 k 2 k 5" (# 433/0 5" (# 433/0    2  k 2  k 5" ,- 433/0 5" ,- 433/0    5! ,- 433/0 5! ,- 433/0      5# (# 433/0 5# (# 433/0    5# ,- 433/0 5# ,- 433/0    5$ (# 433/0 5$ (# 433/0    2  k 2  k # n &6 # n &6 5$ ,- 433/0 5$ ,- 433/0    # n &6 # n &6 5! (# 433/0 5! (# 433/0      2 k 2 k
an3151 short-circuit protection doc id 17051 rev 1 29/34 short-circuit protection is implemented by me ans of a simple external circuitry based on: low-power quad voltage comparator (lm339) quad 2 input and gate(74hc08) the sensing signal is compared with an extern al reference set by a voltage divider providing an active low output on each string. the four outputs are in and in order to have a single fault signal, which is an input managed by the microcontroller thanks to the tim1_bkin pin. when tim1_bkin input ( figure 4 ) is active, with a programmable polarity, the output stage control disables all channels in order to protect the hardware. figure 21 shows a short-circuit event managed by the tim1_bkin. figure 21. short-circuit event
bill of material an3151 30/34 doc id 17051 rev 1 9 bill of material another inductor has been tested on this platform . better results in terms of efficiency were achieved thanks to a lower dc resistance. for mechanical space reasons these inductors have not been used in the power stage. for any efficiency tests consider also the mu rata power inductor with 1.5 mh up to 1.3 a (1415513c). table 3. bom reference part / value technology information package manufacturer manufacturer code c1,c4,c7,c10 220 nf ceramic cap. c2,c5,c8,c11 47 f cap poly rad. c3,c6,c9,c12 220 pf smd mult.ceramic cap. 0805 c41,c44 100 nf smd mult.ceramic cap. 0805 c43 10 f cap poly rad. 0805 d1,d2,d3,d4 stps1l60 power schottky rectifier stmicroelectronics stps1l60 d10 led diode 1206 j1,j2,j3,j5,j7, j26 connector th j4 pwm connector connector-female th j6 sensing connector connector-female th l1,l2,l3,l4 820 uh inductor wurth electronics inc 7447709821 q1,q2,q3,q4 stn3nf06 stripfet? ii power mosfet sot223 stmicroelectronics stn3nf06 r2,r5,r56, r11 620 thick film resistor 1206 r1 10 1206 r3,r6,r9,r12 0.68 thick film resistor 1206 cyntec RLT16324R680FN-06 r7,r10,r60 10 thick film resistor 1206 r47 1 k thick film resistor 1206
an3151 bill of material doc id 17051 rev 1 31/34 figure 22 gives some technical information related to the everlight led: figure 22. electro-optical characteristics
references an3151 32/34 doc id 17051 rev 1 10 references 1. stm8s reference manual; rm0016 2. stm8s207xx/stm8s208xx datasheet; performance line, 24 mhz stm8s 8-bit mcu, up to 128 kbytes flash, integrated eeprom, 10-bit adc, timers, 2 uarts, spi, i 2 c, can 3. an2928 application note; modified buck convertor for led applications 4. everlight high power led-3w: ehp-ax08el/gt01h-p03/5670/y/n11-v4
an3151 revision history doc id 17051 rev 1 33/34 11 revision history table 4. document revision history date revision changes 24-aug-2010 1 initial release.
an3151 34/34 doc id 17051 rev 1 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a parti cular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. unless expressly approved in writing by an authorized st representative, st products are not recommended, authorized or warranted for use in milita ry, air craft, space, life saving, or life sustaining applications, nor in products or systems where failure or malfunction may result in personal injury, death, or severe property or environmental damage. st products which are not specified as "automotive grade" may only be used in automotive applications at user?s own risk. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2010 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of RLT16324R680FN-06

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X